import request from '_utils/request'
// 请求商品列表接口
const getCataLists = (params = {}) => (
  request.get('/cataLists', { params })
)
// 新增商品接口
const cataAdd = (params = {}) => (
  request.post('/cataAdd', params)
)
// 更新商品接口
const cataUpdated = (params = {}) => (
  request.post('/cataUpdated', params)
)
// 删除商品
const deleteItem = (index) => (
  request.delete('/deleteItem', { params: { index } })
)

// 商品列表
const getItemLists = (params = {}) => (
  request.get('/itemLists', { params })
)
// 新增商品
const itemAdd = (params = {}) => (
  request.post('/itemAdd', params)
)
// 获取商品详情 getItemDetail
const getItemDetail = id => (
  request.get('/getItemDetail', { params: { id } })
)
//  首页顶部数据
const UpdateNum = (params = {}) => {
  return request.post('/UpdateNum', params)
}
// 首页图表数据
const ChartNumber = (params = {}) => {
  return request.post('/chartNum', params)
}
// 首页图表2数据
const ChartNumber2 = (params = {}) => {
  return request.post('/chartsTwo', params)
}
// 订单状态
const GoodsMsg = (params = {}) => {
  return request.post('/goodsMan', params)
}
// 订单详情
const detailsGoods = id => {
  return request.get('/detailGoods', { params: { id } })
}
// 登录接口
const LoginPage = (params = {}) => {
  return request.post('/LoginApp', params)
}
// 更改个人信息
const UpdateUser = (params = {}) => {
  return request.post('/UpdateUser', params)
}
// 请求路由
const getRoute = (params = {}) => {
  return request.get('/UpdateUser', { params })
}
export {
  getRoute,
  LoginPage,
  UpdateUser,
  GoodsMsg,
  detailsGoods,
  UpdateNum,
  ChartNumber,
  ChartNumber2,
  getItemDetail,
  getItemLists,
  getCataLists,
  cataAdd,
  cataUpdated,
  deleteItem,
  itemAdd
}
